<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <title>${enquiry.enquiryName!}_安装通</title>
    <link href="/res/css/respective/xiangMuHui/xiangMuHui.css" rel="stylesheet">
    <style type="text/css">
        .icbutt {
            cursor: default !important;
        }
        .endbtn {
            color: #284d61 !important;
            border-color: #284d61 !important;
        }
        .dqWz a {
            color: #8e8e8e;

        }
        .dqWz a:hover {
            color: #00b1db;
        }
    </style>
</head>
<body style="background-color: #f2f2f2;">
[#include "/front/common/front_head.html"]
<div class="warp" style="margin-top: 30px;"> 
    <div class="xiangMuHuiOuter">
        <div style="background: #222e3c;padding: 35px 0 0 0;">
            <div class="spCent itermOne">
                <div class="dqWz">
                    <label>当前位置：</label>
                    <dfn><a href="/">首页</a></dfn>&nbsp;>
                    <dfn><a href="/xmh">项目汇</a></dfn>&nbsp;>
                    <label>询价单</label>
                </div>
                <div>
                <div class="halfIterm halfLeft" style="position: relative;">
                    <div [#if enquiry.state == 4 || enquiry.state == 5]style="position: relative;"[/#if]>
                        [#if enquiry.state == 4]
                        <img class="plend" src="/res/images/respective/xiangMuHui/closed_03.png" alt="">
                        [/#if]
                        [#if enquiry.state == 5]
                            <img class="plend" src="/res/images/respective/xiangMuHui/end_03.png" alt="">
                        [/#if]
                        <p>
                            <dfn class="icbutt">[#if enquiry.qtype == 1]预算询价[#else]采购询价[/#if]</dfn><strong>${enquiry.enquiryName!}</strong>
                        </p>
                        <p>
                            <label>发布时间：</label>
                            <dfn class="ymd">${enquiry.pubdate?date!}</dfn>
                            <label style="margin-left: 35px;">报价截止时间：</label>
                            <dfn class="ymd">${enquiry.deadline?date!}</dfn>
                        </p>

                        <p [#if !enquiry.attachfile?? || enquiry.attachfile == '']style="display: none"[/#if]>
                            <label>附件：</label>
                            <a href="${enquiry.attachfile!}">附件</a>
                        </p>

                        <p style="margin-top: 35px;">
                            [#if enquiry.state != 4 && enquiry.state != 5]<span class="clock">剩余时间计算中</span>[/#if]
                            <span class="big" [#if enquiry.state == 4 || enquiry.state == 5]style="margin-left: 0;"[/#if] >已有<span style="color: #f6a422;font-size: 20px;">${quoteNum!}</span>家参与报价</span>
                        </p> 
                    </div>
                    <p style="position: absolute;bottom: 10px;left: 20px;">
                       <button class="white [#if enquiry.state == 4 || enquiry.state == 5]end endbtn[/#if]" style="margin-right: 0;" onclick="toQuote('${enquiry.id!}')" [#if enquiry.state == 5 || enquiry.state == 4]disabled[/#if]>参与报价</button>
                    </p>
                </div>
                <div class="halfIterm halfRight">
                    <div style="background-color: #263240;padding-right: 20px;">
                        <div>
                            <dfn class="comLogo">
                                [#if hasQuote]
                                    [#if companyInfo.logo?? && companyInfo.logo != '']
                                        <img src="${companyInfo.logo!}" alt="" width="70px" height="70px">
                                    [#else]
                                        <img src="/res/images/common/userLogo_05.png" alt="">
                                    [/#if]
                                [#else]
                                    <img src="/res/images/common/userLogo_05.png" alt="">
                                [/#if]
                            </dfn>
                            <div class="comIntro">
                                <p style="padding: 10px 0;">
                                    <strong style="font-size: 16px;">[#if hasQuote]${company.companyName!}[#else]${company.hiddenCompanyName!}[/#if]</strong>
                                </p>
                                [#if company.auditState! == 3]
                                <p>
                                    <img src="/res/images/respective/xiangMuHui/xmh_03.png" alt="" />
                                </p>
                                [/#if]
                            </div>
                        </div>
                        <div class="lianXi">
                            <p>
                                <label>联系人：</label>
                                <em>[#if hasQuote]${enquiry.contacts!}[#else]${enquiry.contacts?substring(0, 1)}**[/#if]</em>
                            </p>
                            <p>
                                <label>手机：</label>
                                <em>[#if hasQuote]${enquiry.phone!}[#else]***********[/#if]</em>
                            </p>
                            <button class="white" style="margin-right: 0;"
                                    onclick="window.open('tencent://message/?uin=[#if enquiry.id%2 ==0 ]2853909667[#else]2853909668[/#if]&Site=www.azt365.com&Menu=yes')">
                                在线交谈
                            </button>
                        </div>
                        <hr></hr>
                        <div class="lianXi">
                            <p>
                                <i style="background: url(/res/images/respective/xiangMuHui/xiangMuHui.png) -47px -41px no-repeat;"></i>
                                <label>主营类目：</label>
                                [#list categoryList as category]
                                    <label>${category.categoryName!}</label>
                                    [#if category_has_next]
                                        <label class="navLab">|</label>
                                    [/#if]
                                [/#list]
                            </p>
                            [#if hasQuote]
                            <p style="margin-bottom: 6px;">
                                <i style="background: url(/res/images/respective/xiangMuHui/xiangMuHui.png) -61px -16px no-repeat;"></i>
                                <label>地址：</label>
                                <label>
                                    [#if companyInfo.businessProvinceArea??]${companyInfo.businessProvinceArea.name!}[/#if]
                                    [#if companyInfo.businessCityArea??]${companyInfo.businessCityArea.name!}[/#if]
                                    [#if companyInfo.businessAreaArea??]${companyInfo.businessAreaArea.name!}[/#if]
                                    ${companyInfo.businessAddress!}
                                </label>
                            </p>
                            [/#if]
                        </div>
                    </div>
                </div>
                </div>
            </div>
            <div>
                <div class="spCent itermTwo detail">
                    <table style="width: 100%;">
                        <caption style="overflow: hidden;">
                            <div style="display: inline-block;float: left;">
                                <b class="acTab" data-tab="1">项目详情</b>
                                <b data-tab="2">补充说明</b>
                                <b data-tab="3" style="display: none;">关注单位</b>
                            </div>
                        </caption>
                    </table>
                </div>
            </div>
        </div>
        <div class="xiuQiu">
            <div class="spCent itermTwo" style="overflow: hidden;">
                <div class="dtab newFb">
                    <div style="border-bottom: 1px solid #f1f1f1;padding: 0;">
                        <div style="margin-bottom: 15px;padding: 0 15px;">
                            <dfn style="font-size: 16px;">最新发布</dfn>
                        </div>
                    </div>
                    <div id="newPush">
                        <img src="/res/images/oparaStatus/azt_loading.gif" alt="加载中..."/>
                    </div>
                </div>
                <div class="dtab" data-tab="1" style="padding-bottom: 30px;">
                    <table id="itemTable">
                        <caption style="margin-bottom: 20px;overflow: hidden;border-bottom: 1px solid #f1f1f1;padding-bottom: 10px;">
                            <dfn style="font-size: 16px;float: left;">需求产品</dfn>
                            <div class="fanYe" style="margin-top: 0;">
                                <em style="color: #fca711;" data-page="pre">1</em>
                                <em style="margin-left: 0px;">/&nbsp;${pages!1}</em>
                                <a onclick="page(Number($('em[data-page=pre]').html()) - 1)">&lt;</a>
                                <a style="margin-left: -5px;" onclick="page(Number($('em[data-page=pre]').html()) + 1)">&gt;</a>
                            </div>
                        </caption>
                        <tbody>
                        <tr>
                            <th style="width: 20%;">设备名称</th>
                            <th style="width: 15%;">品牌</th>
                            <th style="width: 20%;">型号</th>
                            <th style="width: 15%;">数量</th>
                            <th style="width: 30%;">产品描述</th>
                        </tr>
                        [#list itemList as item]
                        <tr style="display: none;">
                            <td>${item.productName!}</td>
                            <td>${item.brand!}</td>
                            <td>${item.model!}</td>
                            <td class="num">${item.quantity!}${item.unit!}</td>
                            <td>${item.descr!}</td>
                        </tr>
                        [/#list]
                        </tbody>
                    </table>
                    [#--<div style="padding: 25px 0;text-align: center;">
                        <img src="/res/images/respective/xiangMuHui/xmh_07.png" alt="" />
                    </div>--]
                </div>
                <div class="dtab xqMs" data-tab="1">
                    <div>
                        <dfn style="font-size: 16px;">需求描述</dfn>
                    </div>
                    <hr style="border-top: 1px solid #f1f1f1;margin-top: 15px;"></hr>
                    <div style="margin-top: 25px;">
                        <p>
                            <label>类型：</label>
                            <dfn>[#if enquiry.qtype == 1]预算询价[#else]采购询价[/#if]</dfn>
                        </p>
                        <p>
                            <label>报价要求：</label>
                            <dfn>
                            [#if enquiry.taxPrice??]
                                [#if enquiry.taxPrice == 1]含税[#if enquiry.taxInstro??] ${enquiry.taxInstro!}%[/#if][/#if]
                                [#if enquiry.taxPrice == 2]含税[#if enquiry.taxInstro??] ${enquiry.taxInstro!}%[/#if][/#if]
                                [#if enquiry.taxPrice == 3]不含税[/#if]
                            [/#if]
                            [#if enquiry.shipPrice??]
                                [#if enquiry.shipPrice == 1]含运费[/#if]
                                [#if enquiry.shipPrice == 2]不含运费[/#if]
                            [/#if]
                            </dfn>
                        </p>
                    </div>
                    <div>
                        <p>
                            <label>报价截止日期：</label>
                            <dfn>${enquiry.deadline?date!}</dfn>
                        </p>
                        <p>
                            <label>质保要求：</label>
                            <dfn>[#if (enquiry.quality)??]${enquiry.quality!}年[#else]暂无[/#if]</dfn>
                        </p>
                    </div>
                    <div>
                        <p>
                            <label>联系人：</label>
                            <dfn>[#if hasQuote]${enquiry.contacts!}[#else]${enquiry.contacts?substring(0, 1)}**[/#if]</dfn>
                        </p>
                        <p>
                            <label>联系方式：</label>
                            <dfn>[#if hasQuote]${enquiry.phone!}[#else]***********[/#if]</dfn>
                        </p>
                    </div>
                    <div style="padding-bottom: 30px;">
                        <p>
                            <label>项目所在地：</label>
                            <dfn>${enquiry.enqProject.provinceName!} ${enquiry.enqProject.cityName!}</dfn>
                        </p>
                    </div>
                </div>

                <div class="dtab xqMs" data-tab="2" style="margin-top: 0;">
                    <div>
                        <dfn style="font-size: 16px;">补充说明</dfn>
                    </div>
                    <hr style="border-top: 1px solid #f1f1f1;margin-top: 15px;"></hr>
                    <div style="margin-top: 25px;">
                        [#if !enquiry.otherRemarks?? || enquiry.otherRemarks == '']
                            <div style="padding: 25px 0;text-align: center;">
                                <img style="vertical-align: middle;" src="/res/images/respective/xiangMuHui/xmh_07.png" alt="" />
                                <span style="display: inline-block;position: relative;top: 10px;">
                                    此人比较懒，没有补充说明，快去联系他吧!
                                    [#if enquiry.qq?? && enquiry.qq != '']
                                    <a style="display: block;text-align: left;cursor: pointer;color: #00b1db;" target="_blank" href="tencent://message/?uin=${enquiry.qq!}&Site=www.azt365.com&Menu=yes">联系他></a>
                                    [/#if]
                                </span>
                            </div>
                        [#else]
                        <p>${enquiry.otherRemarks!}</p>
                        [/#if]
                    </div>
                </div>

                <div class="dtab guanZhu" data-tab="3">
                    <table>
                        <caption style="margin-bottom: 20px;overflow: hidden;border-bottom: 1px solid #f1f1f1;padding-bottom: 10px;">
                            <dfn style="font-size: 16px;float: left;">关注单位</dfn>
                            <div class="paiXu" style="margin-top: 0;">
                                <em style="color: #999;">排序：</em>
                                <a style="cursor: pointer;text-decoration: none;" href="javascript:void();" onclick="focusChangeOrder(this);return false;">最新关注</a>
                                <i class="time"></i>
                            </div>
                        </caption>
                        <tbody id="focusBody">
                            <tr class="none" style="display: none;">
                                <td>
                                    <img src="/res/images/respective/xiangMuHui/none_03.png" alt="" />
                                    <h2 style="margin-top: 10px;">暂无记录</h2>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="more" onclick="moreFocus()">
                        <a >查看更多</a>
                    </div>
                </div>
                <form id="focusForm">
                    <input type="hidden" id="pageNo" name="pageNo"/>
                    <input type="hidden" id="orderDown" name="orderDown" value="0"/>
                    <input type="hidden" id="enquiryId" name="enquiryId" value="[#if enquiry??]${enquiry.id!}[/#if]"/>
                </form>
            </div>
        </div>
      	<!-- 底部菜单-->
		[#include "/front/common/front_foot.html"]
    </div>
</div>
<script type="text/javascript" src="/res/third/layer/layer.js"></script>
<script type="text/javascript" src="/res/third/laytpl/laytpl.js"></script>
<script type="text/javascript" src="/res/js/common/moment.min.js"></script>
<script type="text/javascript" src="/res/js/xiangMuHui/xiangMuHui.js"></script>
<script type="text/javascript" src="/res/js/common/util.js"></script>

<script type="text/html" id="focusTemplate">
    {{# $.each(d.data , function(i , c){}}
        <tr>
            <td>
                <dfn class="comLogo">
                    <img src="{{= c.logo||'/res/images/respective/xiangMuHui/xmh_07.png'}}" alt="">
                </dfn>
                <div class="intro">
                    <strong>{{= c.companyName}}</strong>
                    <p>
                        <img src="/res/images/respective/xiangMuHui/guanZhu_03.png" alt="" />
                        <em>{{# if(c.state ==3){}}已认证{{#}else{}}未认证{{#}}}</em>
                    </p>
                    <p style="width: 775px;">
                        <img src="/res/images/respective/xiangMuHui/guanZhu_06.png" alt="" />
                        <em>{{=c.province}} {{= c.city}} {{=c.area}}</em>
                        <em class="time">
                            {{# var d = fromNow(c.quoteDate); }}
                            {{# if(d.day > 0) { }}{{ d.day }}天前{{# } }}
                            {{# if(d.hour > 0) { }}{{ d.hour }}小时前{{# } }}
                            {{# if(d.minute > 0) { }}{{ d.day }}分钟前{{# } }}
                        </em>
                    </p>
                </div>
            </td>
        </tr>
    {{# }) }}
</script>

<script type="text/html" id="newPushTemplate">
    {{# $.each(d.data , function(i , e){}}
        <div style="margin-top: 20px;">
            <div class="iterm">
                <dfn class="comLogo">
                    <img src="{{= e.logo || e.pLogo || e.ppLogo ||'/res/images/common/userLogo_05.png'}}" alt="">
                </dfn>
                <div class="fbIntro">
                    <h5>{{= e.ppCompany || e.parentCompany || e.companyName}}</h5>
                    <p>
                        <em>{{= e.enquiryName}}</em>
                        <em class="time">
                            {{# var d = fromNow(e.pubdate); }}
                            {{# if(d.day > 0) { }}{{ d.day }}天前{{# } }}
                            {{# if(d.hour > 0) { }}{{ d.hour }}小时前{{# } }}
                            {{# if(d.minute > 0) { }}{{ d.day }}分钟前{{# } }}
                        </em>
                    </p>
                </div>
            </div>
            <div class="fbJs">
                    {{# if(e.state == 1){}}<b>进行中</b>{{#}}}
                    {{# if(e.state == 0 || e.state == 3){}}<b class="in">审核中</b>{{#}}}
                    {{# if(e.state == 5){}}<b class="end">已截止</b>{{#}}}
                {{# if (e.state == 1) { }}
                {{# var d = fromNow(moment(e.deadline).add(1, 'days')); }}
                <p>
                    <label>剩余时间：</label>
                    <dfn>
                        {{# if(d.day > 0) { }}
                        <strong>{{d.day}}</strong>天
                        {{# } }}
                        {{# if(d.hour > 0) { }}
                        <strong>{{d.hour}}</strong>小时
                        {{# } }}
                        {{# if(d.minute > 0) { }}
                        <strong>{{d.minute}}</strong>分钟
                        {{# } }}
                </p>
                {{# } }}
                <p>
                    <label>信息类型：</label>
                    <dfn>{{# if(e.qtype == 1){}}预算询价{{#}else{}}采购询价{{#}}}</dfn>
                </p>
                <p>
                    <label>已有报价：</label>
                    <dfn><strong>{{= e.quoteCount||'0'}}</strong>家</dfn>
                </p>
            </div>
            <a onclick="window.open('/xmh/{{= e.enqId}}')">查看详情</a>
        </div>
    {{# }) }}
</script>

<script type="text/javascript">
    /*$(window).scroll(function(){
        var scrollTop=$(document).scrollTop();
        if((scrollTop > 450)|(scrollTop==450)){
            $(".fixTab").addClass("fixTabCls");
        }else{
            $(".fixTab").removeClass("fixTabCls");
        }
    }).trigger('scroll');*/

    $(function() {
        $('div[data-tab]').not('[data-tab=1]').hide();
        calcDeadline();
        setInterval(calcDeadline, 1000);
        page(1);

        $.ajax({
            url : '/getNewPush' ,
            type : 'post' ,
            dataType : 'json' ,
            success : function(data){
                if(data.success){
                    laytpl($('#newPushTemplate').html()).render({ data : data.attributes.data} , function (html) {
                        $('#newPush').html(html);
                    });
                }
            }
        });

        //getFocusCompanys();
        var l=$(".halfLeft").height();
        var r=$(".halfRight").height();
        if(parseFloat(l)<parseFloat(r)){ 
        	$(".halfLeft").height(r);
        }
    });

    $('.detail b[data-tab]').on('click', function() {
        var tab = $(this).attr('data-tab');
        $('.detail b[data-tab]').removeClass('acTab');
        $(this).addClass('acTab');
        $.each($('.xiangMuHuiOuter div[data-tab]'), function() {
            $('div[data-tab=' + tab + ']').show();
            $('div[data-tab]').not('[data-tab=' + tab + ']').hide();
        });
    });

    function calcDeadline() {
        var d = fromNow('${enquiry.deadline?date!} 23:59:59');
        var dayStr = d.day > 0 ? d.day + '天' : '';
        var hourStr = d.hour > 0 ? d.hour + '小时' : '';
        var minuteStr = d.minute > 0 ? d.minute + '分' : '';
        var secondStr = d.second > 0 ? d.second + '秒' : '';
        $('.halfIterm .clock').html('剩余' + dayStr + hourStr + minuteStr + secondStr);
    }

    function page(pageNum) {
        if(pageNum < 1 || pageNum > ${pages}) {
            return;
        }
        var $items = $('#itemTable tr:gt(0)');
        $.each($items, function(i, v) {
            if(i >= (pageNum - 1) * 10 && i <= pageNum * 10 - 1) {
                $(v).show();
            } else {
                $(v).hide();
            }
        });
        $('em[data-page=pre]').html(pageNum);
    }

    function toQuote(enquiryId) {
        layer.load(2, {shade: 0.1});
        $.ajax({
            url : '/canQuote',
            type : 'post',
            data : {enquiryId : enquiryId},
            dataType : 'json',
            success : function(data) {
                if(data && data.success) {
                [#if Session.currentRole?? && Session.currentRole.roleType == 1]
                    //具有双重身份，但当前身份不是供应商，自动切换至供应商身份
                    $.post('/user/switch', function(data) {
                        if(data.success){
                            location.href = '/enquiry/quote?enquiryId=' + enquiryId;
                        }else{
                            layer.alert('操作失败');
                        }
                    },"json");
                [#else]
                    location.href = '/enquiry/quote?enquiryId=' + enquiryId;
                [/#if]
                } else {
                    if(data.obj == 'login') {
                        _showLoginWin();
                    } else if(data.obj == 'companyInfo') {
                        //没有公司
                        layer.alert(data.msg, {title : '提示',btn : ['去完善', '取消']},
                                function() {
                                    window.open('/company/info');
                                }
                        );
                    } else {
                        layer.alert(data.msg);
                    }
                }
            },
            complete : function() {
                layer.closeAll('loading');
            }
        });
    }

    function getFocusCompanys(isloading , type){
        var loading ;
        $.ajax({
           url : '/focusCompanys' ,
           type : 'post' ,
           dataType : 'json' ,
           data :$("#focusForm").serialize(),
           beforeSend : function () {
               if(isloading){
                   loading = layer.load(2);
               }
           },
           success : function(data){
                if(data.success){
                    if(data.attributes.contentSize == 0 ||(data.attributes.totalPages == data.attributes.currentPage)){
                        $(".more").hide();
                    }else{
                        $(".more").show();
                    }
                    if(data.attributes.contentSize > 0){
                        var html = laytpl($('#focusTemplate').html()).render({ data : data.attributes.data});
                        if(type && type == 1){
                            $('#focusBody').html(html);
                        }else{
                            $('#focusBody').append(html);
                        }
                        $("#orderDown").val(data.attributes.orderDown);
                        $("#pageNo").val(data.attributes.currentPage);
                    }else{
                        $(".none").show();
                    }
                }
           },
           complete : function () {
               layer.close(loading);
           }
        });
    }

    function focusChangeOrder(o) {
        var orderDown = $("#orderDown").val();
        if(orderDown == 0){//从降序变升序
            $("#orderDown").val(1);
        }else{//从升序变降序
            $("#orderDown").val(0);
        }
        $(o).siblings("i").toggleClass("dw");
        $("#pageNo").val(1);
        getFocusCompanys(true , 1);
        return false;
    }

    function moreFocus() {
        $("#pageNo").val(Number($("#pageNo").val()) + 1);
        getFocusCompanys(true);
        return false;
    }
</script>
</body>
</html>